package cn.ytr.crm.mapper;

import cn.ytr.crm.domain.Employee;
import cn.ytr.crm.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    //高级查询
    int selectForCount(QueryObject qo);
    List<Employee> selectForList(QueryObject qo);

    //登录用
    Employee selectByInfo(@Param("name")String name, @Param("password")String password);

    //维护关系 员工与角色中间表
    //增加
    void insertRelation(@Param("employeeId") Long employeeId, @Param("roleId") Long roleId);
    //删除
    void deleteRelation(@Param("empId")Long empId);

    //维护关系 通过部门id(deptId) 更改 deptId
    void updateDeptIdByDeptId(@Param("newDeptId")Long newDeptId, @Param("whereDeptId")Long whereDeptId);

    //通过员工 id 更改密码
    void editPasswordById(@Param("id")Long id, @Param("newPassword")String newPassword);

    //通过员工名称获取员工
    Employee selectByName(String name);

    //通过员工 id 数组批量删除
    void batchDeleteByIds(Long[] ids);

    //通过角色编号查询员工
    List<Employee> selectByRoleSn(String... snArr);
}





























